const { db } = require('../config')
const { command } = require('../config')
const _ = command
const { obd_collection } = require('../config')
exports.main = async (event, context) => {
    console.log('更新区域网格', event)
    const userInfo = event.userInfo;
    // const collection = '1order_list2';
    const condition = event.data;
    const newRegion = condition.region;
    const newGrid = condition.grid;

    let ID = condition.ID;
    if (!ID || !newRegion || !newGrid) {
        return 0
    }

    let _condi = { ID }
    console.log(condition)

    const res = await db.collection(obd_collection)
        .where(_condi)
        // .get()
        .update({
            region: newRegion,
            grid: newGrid
        });

    console.log('查询结果', res)
    return res.updated;

}